package com.tbit.uqbike.manager.exception;

import com.tbit.uqbike.enums.SystemCodeEnum;

/**
 * 基础异常
 *
 * @author Leon
 * 2017年2月24日 下午4:54:56
 */
public class BaseException extends RuntimeException {
    // 错误提示id
    private String msgId;
    // 错误码
    private Integer code;
    // 扩展信息
    private String ext;

    // 该方法是为了使整个项目运行起来，后面去掉
    public BaseException(String msg) {
        super(msg);
        this.msgId = msg;
    }

    // 自定义异常
    public BaseException(String msgId, Integer code) {
        this.msgId = msgId;
        this.code = code;
    }

    // 系统定义异常
    public BaseException(SystemCodeEnum systemCodeEnum) {
        this.msgId = systemCodeEnum.getMsgId();
        this.code = systemCodeEnum.getCode();
    }

    // 带扩展信息的系统异常
    public BaseException(SystemCodeEnum systemCodeEnum, String ext) {
        this.msgId = systemCodeEnum.getMsgId();
        this.code = systemCodeEnum.getCode();
        this.ext = ext;
    }

    public BaseException(String msgId, Integer code, String ext) {
        this.msgId = msgId;
        this.code = code;
        this.ext = ext;
    }

    public String getMsgId() {
        return msgId;
    }

    public void setMsgId(String msgId) {
        this.msgId = msgId;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getExt() {
        return ext;
    }

    public void setExt(String ext) {
        this.ext = ext;
    }
}